<?php
/**
 * Helper to generate a "button" element
 *
 * @author naspeh
 * @version $Id: FormButton.php 633 2008-06-05 13:11:18Z naspeh $
 */
class Core_View_Helper_FormButton extends Zend_View_Helper_FormButton
{
    /**
     * Generates a 'button' element.
     *
     * @access public
     *
     * @param string|array $name If a string, the element name.  If an
     * array, all other parameters are ignored, and the array elements
     * are extracted in place of added parameters.
     *
     * @param mixed $value The element value.
     *
     * @param array $attribs Attributes for the element tag.
     *
     * @return string The element XHTML.
     */
    public function formButton($name, $value = null, $attribs = null)
    {
       if (isset($attribs['icon'])) {
            if (is_null($value)) {
               $value = $attribs['context'];
            }
            switch ($attribs['icon']) {
                case 'tick':
                   $value = '<img src="/shared/blueprint/plugins/buttons/icons/tick.png"/>' . $value;
                    break;
                case 'cross':
                   $value = '<img src="/shared/blueprint/plugins/buttons/icons/cross.png"/>' . $value;
                    break;
                default:
                    break;
            }
            $attribs['escape'] = false;
            unset($attribs['icon']);
       }
       return parent::formButton($name, $value, $attribs);
    }
}